//
// SoapTrace.Net - A soap message monitoring utility. 
//
// Copyright (C) 2005 Matthew Ward
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// Matthew Ward (mrward@users.sourceforge.net)


using NUnit.Framework;
using SoapTrace.Core.Formatters;
using System;
using System.Drawing;
using System.Windows.Forms;

namespace SoapTrace.Tests.RichTextBoxFormatting
{
	/// <summary>
	/// Tests the <see cref="RichTextBoxFormatter"/> with formatted xml.
	/// </summary>
	[ TestFixture ]
	public class XmlElementFormatTestFixture : RichTextBoxFormatterTestFixtureBase
	{
		FormattedText m_FormattedText;
		XmlFormatter m_Formatter;
		
		string m_Text = "<abc/>";
		
		/// <summary>
		/// Initialises each test.
		/// </summary>
		[ SetUp ]
		public void Init( )
		{
			m_Formatter = new XmlFormatter( );
			m_FormattedText = m_Formatter.Format( m_Text );

			base.CreateTextBox( );
			
			RichTextBoxFormatter.Format( RichTextBox, m_FormattedText );
		}
		
		/// <summary>
		/// Checks the element's start tag is coloured correctly.
		/// </summary>
		[ Test ]
		public void ElementStartDelimiterColour( )
		{
			Assert.AreEqual( m_Formatter.MarkupDelimiterColour, GetTextColour( "<", 0 ),
			                "Element start tag is the wrong colour." );
		}
		
		/// <summary>
		/// Checks the element's tag name is coloured correctly.
		/// </summary>
		[ Test ]
		public void ElementNameColour( )
		{
			Assert.AreEqual( m_Formatter.ElementColour, GetTextColour( "abc", 1 ),
			                "Element tag name is the wrong colour." );
		}		
	}
}
